package com.jeecms.wicool.manager.car.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.jeecms.common.hibernate3.Updater;
import com.jeecms.common.page.Pagination;
import com.jeecms.wicool.dao.car.CarOrderConfDetailDao;
import com.jeecms.wicool.entity.car.CarOrderConfDetail;
import com.jeecms.wicool.manager.car.CarOrderConfDetailMng;

@Service
@Transactional
public class CarOrderConfDetailMngImpl implements CarOrderConfDetailMng {
	
	private CarOrderConfDetailDao dao;
	@Autowired
	public void setDao(CarOrderConfDetailDao dao) {
		this.dao = dao;
	}
	
	@Transactional(readOnly = true)
	public Pagination getPage(Integer carOrderConfId,int pageNo, int pageSize) {
		Pagination page = dao.getPage(carOrderConfId,pageNo, pageSize);
		return page;
	}
	@Override
	public CarOrderConfDetail findById(Integer id) {
		CarOrderConfDetail entity = dao.findById(id);
		return entity;
	}

	@Override
	public CarOrderConfDetail update(CarOrderConfDetail bean) {
		Updater<CarOrderConfDetail> updater = new Updater<CarOrderConfDetail>(bean);
		bean = dao.updateByUpdater(updater);
		return bean;
	}
	
	@Override
	public CarOrderConfDetail save(CarOrderConfDetail bean) {
		dao.save(bean);
		return bean;
	}

	@Override
	public CarOrderConfDetail deleteById(Integer id) {
		CarOrderConfDetail bean = dao.deleteById(id);
		return bean;
	}
	@Override
	public CarOrderConfDetail[] deleteByIds(Integer[] ids) {
		CarOrderConfDetail[] beans = new CarOrderConfDetail[ids.length];
		for (int i = 0,len = ids.length; i < len; i++) {
			beans[i] = deleteById(ids[i]);
		}
		return beans;
	}

	@Override
	public CarOrderConfDetail getByCarOrderConfId(Integer carOrderConfId) {
		return dao.getByCarOrderConfId(carOrderConfId);
	}

}